package com.cyandpos.pad.tradedetails.adapter;

import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.cyandpos.pad.R;
import com.cyandpos.pad.posdata.Order;

import java.util.List;

public class TradeDetailsAdapter extends BaseAdapter {
	private List<Order> mList;
	private LayoutInflater mInflater;

	public TradeDetailsAdapter(List<Order> list, LayoutInflater inflater) {
		this.mInflater = inflater;
		this.mList = list;
	}

	@Override
	public int getCount() {
		return mList.size();
	}

	@Override
	public Object getItem(int arg0) {
		return mList.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		if (convertView == null) {
			//convertView = mInflater.inflate(R.layout.lvitem_tradedetails, null);
		}

		//相邻两项不同色
		if (position % 2 == 0) {//position从0开始
			convertView.setBackgroundColor(Color.parseColor("#f1f0f5"));
		} else {
			convertView.setBackgroundColor(Color.parseColor("#ffffff"));
		}
		/*TextView jlbh = (TextView) convertView.findViewById(R.id.tv_jlbh_lvitem_tradeDetails);
		TextView xsje = (TextView) convertView.findViewById(R.id.tv_salemoney_lvitem_tradeDetails);
		TextView jzrq = (TextView) convertView.findViewById(R.id.tv_saletime_lvitem_tradeDetails);
		jlbh.setText(mList.get(position).getJlbh()+"");
		xsje.setText(mList.get(position).getTotalAmount());
		jzrq.setText(mList.get(position).getOrderTime());*/


		return convertView;
	}
}
